package com.xsoft.web.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Pattern;

public abstract class AppUtils
{
	public static int checkUserName(String username){
		if(username==null || username.length()==0){
			return -1;
		}
		if(!Pattern.matches("^[a-zA-Z].*",username)){
			return -2;
		}
		if(username.length()<6 || username.length()>20){
			return -3;
		}
		if(!Pattern.matches("^[a-zA-Z][\\w]*[0-9a-zA-Z]$",username)){
			return -4;
		}
		return 0;
	}
	
	public static String getNowTime(){
		return new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date());
	}

}
